﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VirtualOperator
{
    public enum Direction {SINK, SOURCE, NONE}
    public class NwTTP : System.IEquatable<NwTTP>
    {
        private string name;
        private int id;
        private Direction type;
        private int managerId;
        public int ManagerID { get { return managerId; } }
        public bool UniConnected { get; set; }
        public string Name { get { return name; } }
        public int ID { get { return id; } }
        public Direction Type { get { return type;  } }
        public static IEqualityComparer<NwTTP> Default
        { get { return (IEqualityComparer<NwTTP>)(new REComparer()); } }
        public int Port { get; private set; }

        public NwTTP(int id, int managerId, string name, Direction type, int port)
        {
            this.managerId = managerId;
            this.name = name;
            this.id= id;
            this.type= type;
            this.Port = port;
        }


        public class REComparer : IEqualityComparer<NwTTP>
        {
            public bool Equals(NwTTP e1, NwTTP e2)
            {
                if (e1.ID == e2.ID)
                    return true;
                else
                    return false;

            }

            public int GetHashCode(NwTTP entry)
            {
                return this.GetHashCode();
            }
        }

        public override string ToString()
        {
            return this.Name;
        }

        public bool Equals(NwTTP other)
        {
            if (this.ID == other.ID)
                return true;
            else
                return false;

        }

    }


    }

